home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1985 September / 1985-09.d64 / weather prophet (.txt) < prev   
Commodore BASIC  |  2022-09-20  |  13KB  |  351 lines

  1. 20 print"[147]":poke53280,1:poke53281,1:poke198,0
  2. 30 rem if computer is +4, delete "rem" in line 40
  3. 40 rem color 0,2:poke65305,249
  4. 50 dimin$(720),ho%(720),mh(12),ml(12),ar(12),as(12),no%(720),d%(50)
  5. 60 bl$="                                        "
  6. 70 fort=1to12:readmh(t):next:fort=1to12:readml(t):next
  7. 80 fort=1to12:readar(t):next:fort=1to12:readas(t):next
  8. 90 fort=1to8:readdi$(t):next
  9. 100 open15,8,15:open1,8,2,"rc.index,s,r"
  10. 110 input#15,a:ifa=62thengosub240:goto1110
  11. 120 input#1,rc%,tr%,hd$,cd$,mp$,ap$,ms$,as$:gosub240:ifrc%=720thenrc%=0
  12. 130 goto1110
  13. 140 open4,4,7:cmd4:return
  14. 150 print#4:close4:return
  15. 160 print#15,"p"+chr$(2)+chr$(lb)+chr$(hb)+chr$(1):return
  16. 170 hb=int(x1/256):lb=x1-hb*256:return
  17. 180 rc$="":fora=1to100:get#1,a$:rc$=rc$+a$:next:return
  18. 190 print#15,"i0":return
  19. 200 close1:open1,8,2,"wx.data,l,"+chr$(100):return
  20. 210 open15,8,15:gosub190:return
  21. 220 getg$:ifg$=""then220
  22. 230 return
  23. 240 close1:close15:return
  24. 250 mo=0:print"[147][197]nter number of month for report:";:inputmo
  25. 260 yr=0:print"[147][197]nter year for report";:inputyr
  26. 270 ifmo<1ormo>12then250
  27. 280 print"[147]                  [215]ait!!"
  28. 290 hi=0:lo=200:ba=0:ra=0:sn=0:ws=0:de=0:ed=0:rh=0:bl=33:pc=0
  29. 300 print"             [208]reparing [210]eport":gosub210:gosub200
  30. 310 forx1=1totr%:gosub170:g$="":gosub160
  31. 320 fora=1to6:get#1,a$:g$=g$+a$:next
  32. 330 ifyr<>val(mid$(g$,5,2))then360
  33. 340 ifmo=val(mid$(g$,3,2))thengosub630
  34. 350 ifmo<val(mid$(g$,3,2))thenx1=tr%
  35. 360 next:close1:gosub190:close15
  36. 370 iflo=200thenprint"[147][206]o data for this month exists.":goto620
  37. 380 ifpr=1thengosub140
  38. 390 print"[147]  [205]onthly [210]eport for :[146]";mo;"/"yr
  39. 400 print"[206]ormal [200]igh:";mh(mo);:print"   [206]ormal [204]ow:"ml(mo)
  40. 410 print"[206]ormal [210]ain: "ar(mo);:print"  [206]ormal [211]now: "as(mo)
  41. 420 print"[200]ighest [194]arometer reading..."ba:
  42. 430 print"on "mid$(da$(1),3,2)"/"mid$(da$(1),1,2)"/"mid$(da$(1),5,2)
  43. 440 print"[204]owest [194]arometer reading...."bl
  44. 450 print"on "mid$(da$(2),3,2)"/"mid$(da$(2),1,2)"/"mid$(da$(2),5,2)
  45. 460 print"[200]ighest [212]emperature........."hi
  46. 470 print"on "mid$(da$(3),3,2)"/"mid$(da$(3),1,2)"/"mid$(da$(3),5,2)
  47. 480 print"[204]owest [212]emperature.........."lo
  48. 490 print"on "mid$(da$(4),3,2)"/"mid$(da$(4),1,2)"/"mid$(da$(4),5,2)
  49. 500 print"[200]ighest [215]ind "ws" from ";di$(wd)
  50. 510 print"on "mid$(da$(5),3,2)"/"mid$(da$(5),1,2)"/"mid$(da$(5),5,2)
  51. 520 printpc;"[196]ays with precipitation."
  52. 530 print"[205]ost rainfall..............."ra
  53. 540 print"on "mid$(da$(6),3,2)"/"mid$(da$(6),1,2)"/"mid$(da$(6),5,2)
  54. 550 print"[200]eaviest [211]nowfall..........."sn
  55. 560 print"on "mid$(da$(7),3,2)"/"mid$(da$(7),1,2)"/"mid$(da$(7),5,2)
  56. 570 print"[200]ighest [200]umidity............"rh
  57. 580 print"on "mid$(da$(9),3,2)"/"mid$(da$(9),1,2)"/"mid$(da$(9),5,2)
  58. 590 print"[212]otal [200]eating [196]egree [196]ays..."de
  59. 600 print"[212]otal [195]ooling [196]egree [196]ays..."ed
  60. 610 ifpr=1thengosub150
  61. 620 gosub2350:return
  62. 630 gosub160:gosub180
  63. 640 ifba<val(mid$(rc$,7,5))thenba=val(mid$(rc$,7,5)):da$(1)=mid$(rc$,1,6)
  64. 650 ifbl>val(mid$(rc$,7,5))thenbl=val(mid$(rc$,7,5)):da$(2)=mid$(rc$,1,6)
  65. 660 ifhi<val(mid$(rc$,13,3))thenhi=val(mid$(rc$,13,3)):da$(3)=mid$(rc$,1,6)
  66. 670 iflo>val(mid$(rc$,16,3))thenlo=val(mid$(rc$,16,3)):da$(4)=mid$(rc$,1,6)
  67. 680 ifws<val(mid$(rc$,20,3))thenws=val(mid$(rc$,20,3)):wd=val(mid$(rc$,19,1))
  68. 690 ifws=val(mid$(rc$,20,3))thenda$(5)=mid$(rc$,1,6)
  69. 700 ifra<val(mid$(rc$,23,5))thenra=val(mid$(rc$,23,5)):da$(6)=mid$(rc$,1,6)
  70. 710 ifval(mid$(rc$,23,5))<>0thenpc=pc+1
  71. 720 ifsn<val(mid$(rc$,28,4))thensn=val(mid$(rc$,28,4)):da$(7)=mid$(rc$,1,6)
  72. 730 ifrh<val(mid$(rc$,32,3))thenrh=val(mid$(rc$,32,3)):da$(9)=mid$(rc$,1,6)
  73. 740 h=val(mid$(rc$,13,3)):l=val(mid$(rc$,16,3))
  74. 750 tp=65-int((h+l)/2):ifsgn(tp)=-1thentp=int((h+l)/2)-65:goto770
  75. 760 de=de+tp:goto780
  76. 770 ed=ed+tp
  77. 780 return
  78. 790 print"[147]      [211]earching for "mo$"/"da$"/"yr$
  79. 800 gosub210:gosub200:r=0:forpt=1totr%:x1=pt:gosub170:rc$=""
  80. 810 gosub160:rc$="":fora=1to6:get#1,a$:rc$=rc$+a$:next
  81. 820 ifse$=rc$thenr=pt:pt=tr%:rc$=""
  82. 830 next
  83. 840 ifr=0then870
  84. 850 a$="":gosub160:gosub180
  85. 860 gosub240:return
  86. 870 gosub240:print"          [210]ecord not found.":return
  87. 880 f=1:print"[147][211]earch by [198][146]ield or [210][146]ecord number?"
  88. 890 gosub220:ifg$="r"then1060
  89. 900 ifg$<>"f"then890
  90. 910 print"[147][197]nter number of field for search:"
  91. 920 printtab(7)" 1. [146]  [211]pecific [196]ate
  92. 930 [153][163]7)" 2. wait  chr$enerate (NULL)onthly (NULL)eport
  93. 940 printtab(7)" 3. [146]  [210]eturn to [205]ain [205]enu
  94. 950 [141]220:g[178][198](g$)[171]48:[145]g[137]980,250,970
  95. 960 [137]950
  96. 970 [142]
  97. 980 [153]"load               (NULL)earch for str$ate
  98. 990 print"[197]nter date (month, day, year)"
  99. 1000 print"[211]eparate each entry with a comma.":inputmo$,da$,yr$
  100. 1010 ifval(da$)<=9thenda$="0"+da$
  101. 1020 ifval(mo$)<=9thenmo$="0"+mo$
  102. 1030 ifval(yr$)<=9thenyr$="0"+yr$
  103. 1040 se$=da$+mo$+yr$:gosub790:ifr=0thengosub2350:return
  104. 1050 gosub2640:gosub2350:return
  105. 1060 print"[147]":gosub210:gosub200:rc$=""
  106. 1070 print"[210]ecord number for [211]earch?":inputr:ifr>tr%then720
  107. 1080 x1=r:gosub170:gosub160:gosub180:gosub190:gosub240:gosub2640:gosub2350
  108. 1090 return
  109. 1100 gosub240:print"[147][201]nvalid [210]ecord [206]umber":gosub2350:return
  110. 1110 print"":printchr$(14):fl=0:f=0:q=fre(o)
  111. 1120 print"[147]           [215][197][193][212][200][197][210] [208][210][207][208][200][197][212]
  112. 1130 [153]"     1 wait     valnter (NULL)ew str$ata
  113. 1140 print"     2 [146]     [198]orecast
  114. 1150 [153]"     3 wait     (NULL)earch str$ata
  115. 1160 print"     4 [146]     [196]egree [196]ay [210]egister
  116. 1170 [153]"     5 wait     valxit (NULL)rogram
  117. 1180 print"     0 [146]     [212]oggle [208]rinter [207]ption
  118. 1190 [153]"":[153]"     ";tr%;" (NULL)ecords in str$ata peekase.":[153]""
  119. 1200 [139]pr[178]1[167][153]"             (NULL)rinter (NULL)(NULL) "
  120. 1210 [139]pr[178]0[167][153]"             (NULL)rinter (NULL)ascasc "
  121. 1220 [141]220:g[178][197](g$):[145]g[141]1270,3000,880,3150,3280
  122. 1230 [139]g$[178]"0"[167][141]1250
  123. 1240 [137]1110
  124. 1250 [139]pr[178]0[167]pr[178]1:[142]
  125. 1260 [139]pr[178]1[167]pr[178]0:[142]
  126. 1270 [153]"loadvalnter str$ate: (NULL)onth, str$ay, (NULL)ear as 12,31,84"
  127. 1280 [153]"(NULL)eparate each entry with a comma.":[133]mo$,da$,yr$
  128. 1290 [139][197](da$)[179][178]9[167]da$[178]"0"[170]da$
  129. 1300 [139][197](mo$)[179][178]9[167]mo$[178]"0"[170]mo$
  130. 1310 [139][197](yr$)[179][178]9[167]yr$[178]"0"[170]yr$
  131. 1320 [139]rc%[178]0[167]1370
  132. 1330 [141]210:[141]200:x1[178]rc%:[141]170:[141]160
  133. 1340 g$[178]"":[129]a[178]1[164]6:[161]#1,a$:g$[178]g$[170]a$:[130]:[141]240
  134. 1350 [139][202](g$,3,2)[179]mo$[167]mp$[178]"00":ms$[178]"00"
  135. 1360 [139][202](g$,5,2)[179]yr$[167]ap$[178]"00":mp$[178]"00":ms$[178]"00":as$[178]"00"
  136. 1370 ba$[178]"":[141]3020:[141]3030
  137. 1380 hi$[178]"":[153]"loadvalnter left$igh (NULL)emperature:";:[133]hi$
  138. 1390 lo$[178]"":[153]"loadvalnter (NULL)ow (NULL)emperature:";:[133]lo$
  139. 1400 [141]3090:ws$[178]"":[153]"loadvalnter atnverage (NULL)ind (NULL)peed":[133]ws$:ws[178][197](ws$)
  140. 1410 ra$[178]"":[153]"loadvalnter (NULL)recipitation [0.00] inches.":[133]ra$
  141. 1420 mp$[178][196]([197](mp$)[170][197](ra$)):ap$[178][196]([197](ap$)[170][197](ra$))
  142. 1430 sn$[178]"":[153]"loadvalnter (NULL)nowfall to nearest tenth inch.":[133]sn$
  143. 1440 ms$[178][196]([197](ms$)[170][197](sn$)):as$[178][196]([197](as$)[170][197](sn$))
  144. 1450 rh$[178]"":[153]"loadvalnter (NULL)elative left$umidity";:[133]rh$
  145. 1460 cc$[178]"":[153]"loadvalnter lenloud lenover (NULL)ercentage";:[133]cc$
  146. 1470 wc$[178]"":[153]"loadvalnter comment on current (NULL)x lenonditions:"
  147. 1480 [153]"(NULL)imit comments to 40 lenharacters.  ((NULL)ne  full screen line.)
  148. 1490 print"      [196]o not use a [195]omma or [195]olon.      ":print:inputwc$:print"[147]"
  149. 1500 rc$=da$+mo$+yr$+ba$
  150. 1510 rc$=rc$+cr$+left$(bl$,1-len(cr$))
  151. 1520 rc$=rc$+left$(bl$,3-len(hi$))+hi$
  152. 1530 rc$=rc$+left$(bl$,3-len(lo$))+lo$
  153. 1540 rc$=rc$+di$+left$(bl$,1-len(di$))
  154. 1550 rc$=rc$+left$(bl$,3-len(ws$))+ws$
  155. 1560 rc$=rc$+left$(bl$,5-len(ra$))+ra$
  156. 1570 rc$=rc$+left$(bl$,4-len(sn$))+sn$
  157. 1580 rc$=rc$+left$(bl$,3-len(rh$))+rh$
  158. 1590 rc$=rc$+left$(bl$,3-len(cc$))+cc$
  159. 1600 rc$=rc$+wc$+left$(bl$,40-l